PROJECT(%s)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

#LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

INCLUDE(FindCUDA)

#SET(CUDA_NVCC_FLAGS "-arch=sm_20")


INCLUDE_DIRECTORIES(./external)
INCLUDE_DIRECTORIES(./external/cusplibrary)
INCLUDE_DIRECTORIES(${CUDA_SDK_ROOT_DIR}/../shared/inc)
INCLUDE_DIRECTORIES(${CUDA_SDK_ROOT_DIR}/common/inc)
INCLUDE_DIRECTORIES(./src/Levmar)
INCLUDE_DIRECTORIES(./src/Model)


file(GLOB SOURCE_FILES ./src/*.cpp)       
file(GLOB HEADER_MODEL_FILES ./src/Model/*.h)
file(GLOB SWIG_FILES ./src/*.i)
file(GLOB SOURCE_FILES_CUDA ./src/*.cu)
file(GLOB SOURCE_FILES_C ./src/*.c)      

CUDA_ADD_LIBRARY(%s SHARED src/Model/%s.cu src/Levmar/Levmar.cu ${HEADER_MODEL_FILES})
TARGET_LINK_LIBRARIES(%s rt tbb)

SET(HAVE_PYTHON 1)
                        
IF (HAVE_PYTHON)
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})

FIND_PACKAGE(PythonLibs)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(./src/Model/%s.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(./src/Model/%s.i PROPERTIES SWIG_FLAGS "-includeall")
SWIG_ADD_MODULE(%s python ./src/Model/%s.i ./src/Model/%s.cu ./src/Levmar/Levmar.cu ${HEADER_MODEL_FILES})
SWIG_LINK_LIBRARIES(%s %s)
SWIG_LINK_LIBRARIES(%s rt tbb)
ENDIF(HAVE_PYTHON)
           
